package com.hejing.io流概述.处理流之对象流;

import java.io.Serializable;
import java.util.Objects;

/**
 * ClassName: Person
 * Package: com.hejing.io流概述.处理流之对象流
 * Description:
 *
 * @Author: HeJing
 * @Create: 2023-06-02 15:09
 * @Version: 1.0
 */
public class Person implements Serializable {  // Serializable: 属于一个标识接口。
    private String name;
    private int age;

    private String email;

    private int serialUID_test;

    private static final long serialVersionUID = 3130991233223L;

    public Person() {

    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return age == person.age && Objects.equals(name, person.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }
}




















